﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:local="http://schemas.infragistics.com/xaml" xmlns:ig="http://schemas.infragistics.com/xaml" xmlns:igPrim="http://schemas.infragistics.com/xaml/primitives" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="PresentationOptions d">

    <!-- *********************************  TEHEME COLORS  ********************************* -->
    <ResourceDictionary.MergedDictionaries>
      <ResourceDictionary Source="Theme.Colors.xaml" />
      <ResourceDictionary Source="Metro.xamCalendar.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <!-- *********************************  BRUSHES  ********************************* -->
  <SolidColorBrush x:Key="ForegroundBrush" Color="{StaticResource Color_000}" />
  <SolidColorBrush x:Key="TransparentBrush" Color="{StaticResource Color_016}" />
  <SolidColorBrush x:Key="DisabledBackgroundBrush" Color="{StaticResource Color_012}" />

  <!-- Button Brushes -->
  <SolidColorBrush x:Key="ButtonBackgroundBrush" Color="{StaticResource Color_008}" />
  <SolidColorBrush x:Key="ButtonBorderBrush" Color="{StaticResource Color_004}" />
  <SolidColorBrush x:Key="ButtonArrowBackgroundBrush" Color="{StaticResource Color_003}" />
  <SolidColorBrush x:Key="ButtonSeparatorBackgroundBrush" Color="{StaticResource Color_006}" />
  <SolidColorBrush x:Key="ButtonArrowHoverBackgroundBrush" Color="{StaticResource Color_002}" />
  <SolidColorBrush x:Key="ButtonArrowPressedBackgroundBrush" Color="{StaticResource Color_024}" />
  <SolidColorBrush x:Key="ButtonArrowDisabledBackgroundBrush" Color="{StaticResource Color_005}" />

    <!-- DateTimeInput Brushes -->
  <SolidColorBrush x:Key="InputBackgroundBrush" Color="{StaticResource Color_009}" />
  <SolidColorBrush x:Key="InputBorderBrush" Color="{StaticResource Color_004}" />
  <SolidColorBrush x:Key="InputHoverBackgroundBrush" Color="{StaticResource Color_007}" />
  <SolidColorBrush x:Key="InputHoverBorderBrush" Color="{StaticResource Color_003}" />
  <SolidColorBrush x:Key="InputFocusedBorderBrush" Color="{StaticResource Color_024}" />

    <!-- *********************************  Value Converters  ********************************* -->
    <igPrim:ValueConverterGroup x:Key="HorizontalToTextAlignmentConverter">
      <!-- Left to Left -->
      <igPrim:FixedValueConverter>
        <igPrim:FixedValueConverter.SourceValue>
          <HorizontalAlignment>Left</HorizontalAlignment>
        </igPrim:FixedValueConverter.SourceValue>
        <igPrim:FixedValueConverter.DestinationValue>
          <TextAlignment>Left</TextAlignment>
        </igPrim:FixedValueConverter.DestinationValue>
      </igPrim:FixedValueConverter>

      <!-- Center to Center -->
      <igPrim:FixedValueConverter>
        <igPrim:FixedValueConverter.SourceValue>
          <HorizontalAlignment>Center</HorizontalAlignment>
        </igPrim:FixedValueConverter.SourceValue>
        <igPrim:FixedValueConverter.DestinationValue>
          <TextAlignment>Center</TextAlignment>
        </igPrim:FixedValueConverter.DestinationValue>
      </igPrim:FixedValueConverter>

      <!-- Right to Right -->
      <igPrim:FixedValueConverter>
        <igPrim:FixedValueConverter.SourceValue>
          <HorizontalAlignment>Right</HorizontalAlignment>
        </igPrim:FixedValueConverter.SourceValue>
        <igPrim:FixedValueConverter.DestinationValue>
          <TextAlignment>Right</TextAlignment>
        </igPrim:FixedValueConverter.DestinationValue>
      </igPrim:FixedValueConverter>

      <!-- Stretch to Left -->
      <igPrim:FixedValueConverter>
        <igPrim:FixedValueConverter.SourceValue>
          <HorizontalAlignment>Stretch</HorizontalAlignment>
        </igPrim:FixedValueConverter.SourceValue>
        <igPrim:FixedValueConverter.DestinationValue>
          <TextAlignment>Left</TextAlignment>
        </igPrim:FixedValueConverter.DestinationValue>
      </igPrim:FixedValueConverter>

    </igPrim:ValueConverterGroup>

    <igPrim:ValueConverterGroup x:Key="ComplementConverter">
      <!-- True to False -->
      <igPrim:FixedValueConverter>
        <igPrim:FixedValueConverter.SourceValue>
          <sys:Boolean>True</sys:Boolean>
        </igPrim:FixedValueConverter.SourceValue>
        <igPrim:FixedValueConverter.DestinationValue>
          <sys:Boolean>False</sys:Boolean>
        </igPrim:FixedValueConverter.DestinationValue>
      </igPrim:FixedValueConverter>

      <!-- False to True -->
      <igPrim:FixedValueConverter>
        <igPrim:FixedValueConverter.SourceValue>
          <sys:Boolean>False</sys:Boolean>
        </igPrim:FixedValueConverter.SourceValue>
        <igPrim:FixedValueConverter.DestinationValue>
          <sys:Boolean>True</sys:Boolean>
        </igPrim:FixedValueConverter.DestinationValue>
      </igPrim:FixedValueConverter>

    </igPrim:ValueConverterGroup>

    <!-- *********************************  RepeatButton Template  ********************************* -->
    <ControlTemplate x:Key="RepeatButtonTemplate" TargetType="RepeatButton">
      <Grid>
        <VisualStateManager.VisualStateGroups>
          <VisualStateGroup x:Name="CommonStates">
          <VisualState x:Name="Normal" />
            <VisualState x:Name="MouseOver">
              <Storyboard>
                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Fill" Storyboard.TargetName="Arrow">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonArrowHoverBackgroundBrush}" />
                </ObjectAnimationUsingKeyFrames>
              </Storyboard>
            </VisualState>
            <VisualState x:Name="Pressed">
              <Storyboard>
                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Fill" Storyboard.TargetName="Arrow">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonArrowPressedBackgroundBrush}" />
                </ObjectAnimationUsingKeyFrames>
              </Storyboard>
            </VisualState>
            <VisualState x:Name="Disabled">
              <Storyboard>
                <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Fill" Storyboard.TargetName="Arrow">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonArrowDisabledBackgroundBrush}" />
                </ObjectAnimationUsingKeyFrames>
              </Storyboard>
            </VisualState>
          </VisualStateGroup>
          <VisualStateGroup x:Name="FocusStates">
          <VisualState x:Name="Focused" />
          <VisualState x:Name="Unfocused" />
          </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
      <Rectangle Fill="{StaticResource TransparentBrush}" Margin="-5" />
      <Path x:Name="Arrow" Data="M4.9585595,6.4799328 L9.9993324,1.9604321 L15.061378,6.4794879 L13.686531,7.979373 L9.9993334,4.5627856 L6.3744011,7.9793801 z" Height="6" Stretch="Uniform" Width="10" Fill="{StaticResource ButtonArrowBackgroundBrush}" Margin="{TemplateBinding Padding}" />
      </Grid>
    </ControlTemplate>

    <!-- *********************************  SpinButton Style  ********************************* -->
    <Style x:Key="SpinButtonStyle" TargetType="RepeatButton">
    <Setter Property="MinHeight" Value="30" />
    <Setter Property="MinWidth" Value="30" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="Padding" Value="3,1" />
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="igPrim:XamlHelper.Focusable" Value="False" />
    <Setter Property="Template" Value="{StaticResource RepeatButtonTemplate}" />
    </Style>

    <!-- *********************************  DateTimeInputTextBox Style  ********************************* -->
    <Style x:Key="DateTimeInputTextBoxStyle" TargetType="TextBox">
    <Setter Property="Background" Value="{StaticResource TransparentBrush}" />
    <Setter Property="BorderBrush" Value="{StaticResource TransparentBrush}" />
    <Setter Property="BorderThickness" Value="0" />
    </Style>

    <!-- *********************************  DropDownButton Style  ********************************* -->
    <Style x:Key="DropDownButtonStyle" TargetType="ToggleButton">
    <Setter Property="MinWidth" Value="30" />
    <Setter Property="BorderBrush" Value="{StaticResource ButtonBorderBrush}" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="Padding" Value="2" />
    <Setter Property="Cursor" Value="Hand" />
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="ToggleButton">
            <Grid>
              <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                <VisualState x:Name="Normal" />
                  <VisualState x:Name="MouseOver">
                    <Storyboard>
                      <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Fill" Storyboard.TargetName="Arrow">
                      <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonArrowHoverBackgroundBrush}" />
                      </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualState>
                  <VisualState x:Name="Pressed">
                    <Storyboard>
                      <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Fill" Storyboard.TargetName="Arrow">
                      <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonArrowPressedBackgroundBrush}" />
                      </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualState>
                  <VisualState x:Name="Disabled">
                    <Storyboard>
                      <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Fill" Storyboard.TargetName="Arrow">
                      <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonArrowDisabledBackgroundBrush}" />
                      </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="CheckStates">
                <VisualState x:Name="Checked" />
                <VisualState x:Name="Unchecked" />
                </VisualStateGroup>
                <VisualStateGroup x:Name="FocusStates">
                <VisualState x:Name="Focused" />
                <VisualState x:Name="Unfocused" />
                </VisualStateGroup>
              </VisualStateManager.VisualStateGroups>
            <Rectangle Fill="{StaticResource TransparentBrush}" Margin="-5" />
            <Path x:Name="Arrow" Stretch="Fill" Height="6" Width="10" Data="M 0,0 C0,0 7,0 7,0 7,0 3.5,3.5 3.5,3.5 3.5,3.5 0,0 0,0 z" UseLayoutRounding="False" Fill="{StaticResource ButtonArrowBackgroundBrush}" />
            <Rectangle Width="1" Fill="{StaticResource ButtonSeparatorBackgroundBrush}" HorizontalAlignment="Left" Margin="-1,5,0,5" />
            </Grid>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    <Setter Property="Background" Value="{StaticResource ButtonBackgroundBrush}" />
    </Style>

    <!-- *********************************  XamDateTimeInput Style  ********************************* -->
    <Style x:Key="XamDateTimeInputStyle" TargetType="local:XamDateTimeInput">
    <Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
    <Setter Property="BorderBrush" Value="{StaticResource InputBorderBrush}" />
    <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
    <Setter Property="FontSize" Value="14.667" />
    <Setter Property="FontFamily" Value="Segoe UI" />
    <Setter Property="Padding" Value="8,0" />
    <Setter Property="igPrim:XamlHelper.SnapsToDevicePixels" Value="True" />
    <Setter Property="SpinButtonStyle" Value="{StaticResource SpinButtonStyle}" />
    <Setter Property="DropDownButtonStyle" Value="{StaticResource DropDownButtonStyle}" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="MinHeight" Value="30" />
    <Setter Property="HorizontalContentAlignment" Value="Left" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="local:XamDateTimeInput">
                    <igPrim:ValidationDecorator x:Name="MainBorder">
              <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="FocusStates">
                <VisualState x:Name="FocusedDropDown" />
                <VisualState x:Name="Unfocused" />
                  <VisualState x:Name="Focused">
                    <Storyboard>
                      <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="FocusBorder">
                        <EasingDoubleKeyFrame KeyTime="0" Value="1" />
                      </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="CommonStates">
                  <VisualState x:Name="MouseOver">
                    <Storyboard>
                      <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Background" Storyboard.TargetName="Background">
                      <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource InputHoverBackgroundBrush}" />
                      </ObjectAnimationUsingKeyFrames>
                      <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="OverBorder">
                        <EasingDoubleKeyFrame KeyTime="0" Value="1" />
                      </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualState>
                  <VisualState x:Name="Disabled">
                    <Storyboard>
                      <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="DisabledElement">
                        <DiscreteObjectKeyFrame KeyTime="0">
                          <DiscreteObjectKeyFrame.Value>
                            <Visibility>Visible</Visibility>
                          </DiscreteObjectKeyFrame.Value>
                        </DiscreteObjectKeyFrame>
                      </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualState>
                <VisualState x:Name="Normal" />
                <VisualState x:Name="ReadOnly" />
                </VisualStateGroup>
              </VisualStateManager.VisualStateGroups>
            <Grid x:Name="MainGrid" Width="Auto">
                <Grid Height="Auto" Width="Auto">
                  <Border x:Name="Background" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}">
                    <Grid>
                      <Grid.ColumnDefinitions>
                      <ColumnDefinition Width="*" />
                      <ColumnDefinition Width="Auto" />
                      <ColumnDefinition Width="Auto" />
                      </Grid.ColumnDefinitions>
                    <igPrim:MaskedInputTextBox Foreground="{TemplateBinding Foreground}" x:Name="PART_InputTextBox" Style="{StaticResource DateTimeInputTextBoxStyle}" HorizontalAlignment="Stretch" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" VerticalAlignment="Stretch" TextAlignment="{Binding HorizontalContentAlignment, Converter={StaticResource HorizontalToTextAlignmentConverter}, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" InputMethod.PreferredImeState="{TemplateBinding InputMethod.PreferredImeState}" Margin="{TemplateBinding Padding}" />
                      <Grid x:Name="PART_SpinButtons" Grid.Column="1" Visibility="{TemplateBinding SpinButtonVisibilityResolved}">
                        <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="1" />
                        <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <RepeatButton x:Name="spinUp" Style="{TemplateBinding SpinButtonStyle}">
                          <ig:Commanding.Command>
                          <igPrim:MaskedInputCommandSource EventName="Click" CommandId="SpinUp" />
                          </ig:Commanding.Command>
                        </RepeatButton>
                        <RepeatButton x:Name="spinDown" Style="{TemplateBinding SpinButtonStyle}" Grid.Column="2" RenderTransformOrigin="0.5,0.5">
                          <RepeatButton.RenderTransform>
                            <TransformGroup>
                            <ScaleTransform />
                            <SkewTransform />
                            <RotateTransform Angle="180" />
                            <TranslateTransform />
                            </TransformGroup>
                          </RepeatButton.RenderTransform>
                          <ig:Commanding.Command>
                          <igPrim:MaskedInputCommandSource EventName="Click" CommandId="SpinDown" />
                          </ig:Commanding.Command>
                        </RepeatButton>
                      </Grid>
                    <ToggleButton x:Name="PART_DropDownButton" Grid.Column="2" Grid.RowSpan="3" ClickMode="Press" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsEnabled="{Binding IsReadOnly, Converter={StaticResource ComplementConverter}, RelativeSource={RelativeSource TemplatedParent}}" Style="{TemplateBinding DropDownButtonStyle}" igPrim:XamlHelper.Focusable="False" IsTabStop="False" Visibility="{TemplateBinding DropDownButtonVisibility}" />
                    </Grid>
                  </Border>
                <Border x:Name="OverBorder" BorderThickness="1" Opacity="0" BorderBrush="{StaticResource InputHoverBorderBrush}" />
                <Border x:Name="FocusBorder" BorderThickness="1" Opacity="0" BorderBrush="{StaticResource InputFocusedBorderBrush}" />
                <Rectangle x:Name="DisabledElement" Fill="{StaticResource DisabledBackgroundBrush}" Visibility="Collapsed" />
                  <Popup x:Name="PART_Popup">
                    <Border Margin="-1,1,0,0">
                    <ig:XamCalendar x:Name="PART_Calendar" MinDate="{TemplateBinding ComputedMinDate}" MaxDate="{TemplateBinding ComputedMaxDate}" MinCalendarMode="{TemplateBinding ComputedMinCalendarMode}" SelectedDate="{Binding DateValue, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" SelectionMode="SingleDate" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" FontStretch="{TemplateBinding FontStretch}" />
                    </Border>
                  </Popup>
                </Grid>
              </Grid>
                    </igPrim:ValidationDecorator>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
  <Style TargetType="local:XamDateTimeInput" BasedOn="{StaticResource XamDateTimeInputStyle}" />
</ResourceDictionary>